var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  AXSendGiftDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.onLoadFriendOnLineData = {
          caller: e,
          code: 2017,
          method: function (t) {
            if (0 == t.code) {
              var i = t.list;
              if (((e.item_friends_list.visible = !0), i.length > 0)) {
                (e.label_gifts_content.text = ""),
                  (e.list_gifts_friends.visible = !0),
                  (e.btn_sendGift_sure.visible = !1);
                for (var n = void 0, s = [], o = 0; o < i.length; o++) {
                  var d = i[o];
                  (n = {
                    label_item_gifts: { text: d.name },
                    btn_item_gifts: { label: "赠送" },
                    id: d.id,
                  }),
                    s.push(n);
                }
                e.list_gifts_friends.dataSource = s;
              } else
                (e.label_gifts_content.text = t.msg),
                  ToastView.toastView(t.msg);
            }
          },
        }),
        (e.onLoadFriendActionFn = {
          caller: e,
          code: 2019,
          method: function (t) {
            ToastView.toastView(t.data),
              WebSocketService.send({ c: 1425, d: { pageNum: 0 } });
          },
        }),
        WebSocketService.addListener(e.onLoadFriendOnLineData),
        WebSocketService.addListener(e.onLoadFriendActionFn),
        e.btn_sendGift_sure.on(Laya.Event.CLICK, e, e.onDidSendGiftClick),
        e.list_gifts_friends.on(Laya.Event.CLICK, e, e.onGiftsFriendsAction),
        (e.list_gifts_friends.selectEnable = !0),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showSendGiftDialog = function (t) {
        null == this.sendGift &&
          ((this.sendGift = new e()), (this.sendGift.zOrder = 1e3)),
          this.sendGift.popup(),
          (this.sendGift.jsonObj = t),
          (this.sendGift.objNum = 1),
          (this.sendGift.item_friends_list.visible = !1),
          (this.sendGift.item_selected_bg.visible = !1),
          (this.sendGift.list_gifts_friends.visible = !1),
          (this.sendGift.btn_sendGift_sure.visible = !1),
          WebSocketService.send({ c: 2017, d: { gid: t.id, pageNum: 0 } });
      }),
      (e.prototype.onDidSendGiftClick = function () {
        this.close();
        var t = this.list_gifts_friends.selectedItem.id;
        WebSocketService.send({
          c: 2019,
          d: { gid: this.jsonObj.id, id: t, count: this.objNum, bind: 0 },
        });
      }),
      (e.prototype.onGiftsFriendsAction = function () {
        (this.item_friends_list.visible = !1),
          (this.item_selected_bg.visible = !0),
          (this.btn_sendGift_sure.visible = !0),
          (this.label_gifts_numtitle.text = "赠送数量：1");
        var t = MyCustomSliderView.showCustomSliderView(
          1,
          this.jsonObj.num,
          this,
          this.onSliderChangeValueMethod
        );
        t.pos(0, 100, !0), this.item_selected_bg.addChild(t);
      }),
      (e.prototype.onSliderChangeValueMethod = function (t) {
        (this.label_gifts_numtitle.text = "赠送数量：" + t), (this.objNum = t);
      }),
      (e.close = function () {
        this.sendGift && this.sendGift.close();
      }),
      e
    );
  })(ui.TabBarItemController.AXSendGiftDialogUI);
